﻿using Ndns.Forwarder;
using Ndns.ServerHost.Abstractions;
using System;
using System.Collections.Generic;

namespace Ndns.ServerHost.Builder
{
    public static class DnsForwarderMiddlewareBuilder
    {

        public static IMiddlewaresBuilder UseForwarders(this IMiddlewaresBuilder builder, IEnumerable<DnsForwarderInfo> forwarders)
        {
            if (builder == null)
                throw new ArgumentNullException(nameof(builder));

            builder.Use(new DnsForwarderMiddleware(forwarders));

            return builder;
        }
    }
}
